import LoadPage404 from "@/components/error/LoadPage404";
type MicroAppProps = {
    name: string;
    url?: string;
    baseroute?: string;
    style?: object;
    iframe?: boolean,
    scopedStyle?: boolean
    keepAlive?: boolean
};

const WfMicroApp = ({ name, url, baseroute, style, iframe, scopedStyle, keepAlive }: MicroAppProps) => {
    const onChildDataChange = (e: any) => {
        console.log('来自子应用的数据：', e.detail.data)
    };
    if (!url) {
        return (<LoadPage404 />);
    }
    return (
        <micro-app 
            name={name}
            url={url}
            baseroute={baseroute}
            style={style}
            iframe={iframe}
            scopedStyle={scopedStyle}
            keep-alive={keepAlive}
            onDataChange={(e: any) => onChildDataChange(e)}
        />
    );
};

export default WfMicroApp;
